﻿using DotNetty.Handlers.Logging;
using DotNetty.Transport.Bootstrapping;
using DotNetty.Transport.Channels;
using DotNetty.Transport.Channels.Sockets;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace WinChatListen
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            //var bossGroup = new MultithreadEventLoopGroup(1);
            //var workerGroup = new MultithreadEventLoopGroup();
            //try
            //{
            //    var bootstrap = new ServerBootstrap();
            //    bootstrap.Group(bossGroup, workerGroup)
            //    .Channel<TcpServerSocketChannel>()
            //    .Option(ChannelOption.SoBacklog, 100)
            //    .Handler(new LoggingHandler("LISN"))
            //    .ChildHandler(new ActionChannelInitializer<ISocketChannel>(channel =>
            //    {
            //        var pipeline = channel.Pipeline;
            //        pipeline.AddLast(new LoggingHandler("CONN"));
            //        //pipeline.AddLast(new EchoServerHandler());
            //    }));
            //    var bindTask = bootstrap.BindAsync(8888);
            //    bindTask.Wait();
            //    Console.WriteLine($"Echo server started and listening on {bindTask.Result.LocalAddress}");
            //    Console.ReadLine();
            //}
            //finally
            //{
            //    workerGroup.ShutdownGracefullyAsync().Wait();
            //    bossGroup.ShutdownGracefullyAsync().Wait();
            //}

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new WinMain());

        }
    }
}
